const puppeteer = require('puppeteer')
async function getVisual(URL) {
    let filename = URL.split('.')[1]+'.png';
    try {
        const browser = await puppeteer.launch()
        const page = await browser.newPage()
        await page.goto(URL)
        await page.screenshot({ path: filename })
        //await page.pdf({ path: 'page.pdf' })
        await browser.close()
    } catch (error) {
        console.error(error)
    }
}
getVisual('https://movie.douban.com/')